﻿#include "Abilities/TestAbilitySystemComponent.h"

#include "Abilities/TestAttributeSet.h"


UTestAbilitySystemComponent::UTestAbilitySystemComponent()
{
	
}

void UTestAbilitySystemComponent::TickComponent(float DeltaTime, ELevelTick Tick,
	FActorComponentTickFunction* ThisTickFunction)
{
	Super::TickComponent(DeltaTime, Tick, ThisTickFunction);
	TestSpawnedAttributes = GetSpawnedAttributes();
}


TArray<UAttributeSet*> UTestAbilitySystemComponent::BP_GetSpawnedAttributes() const
{
	return GetSpawnedAttributes();
}

float UTestAbilitySystemComponent::BP_GetNumericAttribute() const
{
		
	for(UAttributeSet* Set : GetSpawnedAttributes())
	{
		UTestAttributeSet* TestAttributeSet = Cast<UTestAttributeSet>(Set);
		if(TestAttributeSet)
		{
			FProperty* Property = //TestAttributeSet->GetClass()->FindPropertyByName(FName("Health"));
								  UTestAttributeSet::StaticClass()->FindPropertyByName(FName("Health"));
			if(Property)
			{
				return GetNumericAttribute(Property);
			}
			
			
		}
	}

	return 0.f;

}
